package com.事件处理event.Google恐龙;

public class Circle implements Runnable{
    int x,y;
    int r;
    MyPanel mp = null;
    boolean pool = true;

    public Circle(int x, int y, int r,MyPanel mp ) {
        this.x = x;
        this.y = y;
        this.r = r;
        this.mp = mp;
    }

    @Override
    public void run() {
        pool = false;
        int h = y;
        while(y >= h - 150){
            y--;
            try {
                Thread.sleep(1);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            mp.repaint();
        }
        while(y < h){
            y++;
            mp.repaint();
            try {
                Thread.sleep(1);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }

        }

        pool = true;
    }
}
